public class Main {
    public static void main(String[] args) {
        Dog dog = new Dog("Buddy");
        Cat cat = new Cat("Kitty");
        Bird bird = new Bird("Tweety");

        // 调用 Pet 接口方法
        dog.play();
        cat.play();

        // Bird 没有实现 Pet，所以不能调用 play()
        bird.fly();

        // 也可以通过 instanceof 检查
        if (dog instanceof Pet) {
            System.out.println(dog.getName() + " is a pet.");
        }
        if (!(bird instanceof Pet)) {
            System.out.println(bird.getName() + " is not a Pet implementation.");
        }
    }
}
